﻿using DoNetDrive.Core.Packet;
using DotNetty.Buffers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Face8280WebSocketServer.Command
{
    public class TextPacketDecompile : INPacketDecompile
    {
        public bool Decompile(IByteBuffer buf, List<INPacket> retPacketList)
        {
            try
            {

                var sJson = buf.ReadString(buf.ReadableBytes,Encoding.UTF8);
                
                retPacketList.Add(new TextPacket(sJson));

            }
            catch 
            {
               
            }
            return true;
        }

        public void Dispose()
        {
           
        }
    }
}
